<template>
  <j-select-biz-component :multiple='multiple' :width="multiple?1000:800" :name="name" :buttons='buttons' :inputs="inputs" :queryConfig='queryConfig' :searchIcon='searchIcon' :selectButtonText="selectButtonText"  v-bind="configs" v-on="$listeners"/>
</template>

<script>
import JSelectBizComponent from './JSelectBizComponent'

export default {
  name: 'JSelectCust',
  components: { JSelectBizComponent },
  props: {
    value: {
      type: String,
      default: ''
    },
    rowKey:{
      type: String,
      default: 'id'
    },
    name: {
      type: String,
      default: '客户'
    },
    selectButtonText:{
      type: String,
      default: '选择'
    },
    inputs:{
      type: Boolean,
      default: true
    },
    searchIcon:{
      type: String,
      default: 'search'
    },
    queryConfig:{
      type:Array,
      default:()=>[
        {
          label: '客户名称',
          key: 'custName'
        },
      ]
    },
    listUrl:{
      type:String,
      default: '/customerController/getPageList',
    },
    multiple:{
      type: Boolean,
      default: true
    },
    buttons:{
      type:Boolean,
      default:true
    },
    returnName:{
      type:Boolean,
      default:false
    },
    returnNameKey:{
      type:Boolean,
      default:false
    }
  },
  data() {
    return {
      settings: {
        displayKey: 'custName',
        returnKeys: ['id', 'custCode'],
        queryParamCode: 'custCode',
        queryParamText: '客户编码',
        ellipsisLength:-1,
        columns: [
          { title: '客户名称', field: 'custName', align: 'left', width: '50%', widthRight: '70%' },
          { title: '客户编号', field: 'custCode', align: 'left', width: '50%' },
        ]
      }
    }
  },
  computed: {
    configs() {
      return Object.assign({ value: this.value ,listUrl:this.listUrl,returnName:this.returnName,rowKey:this.rowKey}, this.settings, this.$attrs)
    }
  }
}
</script>

<style lang="less" scoped></style>
